package clases_dao;

import java.sql.Connection;
import java.sql.DriverManager;

public final class Connect {
	
	private Connection connection;
 
	 public Connect(){
	  connection = null;
	  try{
	   String userName = "root";
	   String password = "";
	   String url = "jdbc:mysql://localhost/tddbus";
	   Class.forName ("com.mysql.jdbc.Driver").newInstance ();
	   connection = DriverManager.getConnection(url, userName, password);
	  }
	  catch(Exception e){
	   System.out.println("Exception found");
	  }
	 }
 
 public Connection getConnection(){
  return connection;
 }
 
 public void closeConnection(){
  try{
   connection.close ();
  }catch (Exception e) {
   System.out.println ("Connection close error");
  }
 }
 
}